package com.jky.trial.mapper;

import com.jky.trial.entity.Category;
import com.jky.trial.entity.CategoryExample;
import com.jky.trial.vo.CategoryVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CategoryMapper {
    long countByExample(CategoryExample example);
    Category selectOne(Category record);
    Category selectLatestOne(Category record);

    int deleteByExample(CategoryExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Category record);

    int insertSelective(Category record);
    int insertSelectiveWithId(Category record);

    List<Category> selectByExample(CategoryExample example);

    List<CategoryVo> pageList(CategoryVo example);

    /**
     * record.personType 联系人类型
     * record.type category 类型
     * @param record
     * @return
     */
    List<CategoryVo> pageListWithPerson(CategoryVo record);

    /**
     * 关联项目名称的Category分页
     * example.type     category类型
     * example.deleted   删除状态
     * @param example
     * @return
     */
    List<CategoryVo> pageListWithProject(CategoryVo example);
    List<CategoryVo> withProjectByPermission(CategoryVo example);
    int countWithProjectByPermission(CategoryVo example);

    /**
     * 通过关系源ID、关系类型、Category类型列表
     * record.type Category类型
     * record.rType 关系类型
     * record.rSource 关系源ID
     * @param record
     * @return
     */
    List<CategoryVo> listByDr(CategoryVo record);

    /**
     * 钻机组
     * @param record
     * @return
     */
    List<CategoryVo> selectZj(CategoryVo record);

    Category selectByPrimaryKey(Integer id);
    CategoryVo selectOneByKey(Integer id);

    int updateByExampleSelective(@Param("record") Category record, @Param("example") CategoryExample example);

    int updateByExample(@Param("record") Category record, @Param("example") CategoryExample example);

    int updateByPrimaryKeySelective(Category record);

    int updateByPrimaryKey(Category record);

    /**
     * 寻找描述员所在钻机组
     * record.type 钻机组类型
     * record.pId  项目Id
     * record.rTargetId 描述员Id
     * record.rType 钻机-描述员关系类型
     * @param record
     * @return
     */
    Category selectZjzByDescer(CategoryVo record);
}